#### Table S17: Multilevel regression (Continuous DV) ####

# Libraries
# library(here)
# library(rio)
# library(tidyverse)
# library(lubridate)
# library(stargazer)
# library(lme4)

# data_pnas = import(here("Data","data_pnas.rds"))

c_mod1 = lmer(norm_loyalty ~ voted_overturn + (1 | district) + (1 | uid), data = data_pnas, weights = weight)
c_mod2 = lmer(norm_loyalty ~ voted_overturn*pid + (1 | district) + (1 | uid), data = data_pnas, weights = weight)
c_mod3 = lmer(norm_loyalty ~ denied_538 + (1 | district) + (1 | uid), data = data_pnas, weights = weight)
c_mod4 = lmer(norm_loyalty ~ denied_538*pid + (1 | district) + (1 | uid), data = data_pnas, weights = weight)

stargazer(c_mod1, c_mod2, c_mod3, c_mod4,
          title = "Multilevel Regression Results (Continuous DV)",
          dep.var.labels = "Loyalty (Continuous)",
          covariate.labels = c("Voted to Overturn",
                               "Independent",
                               "Republican",
                               "Voted to Overturn:Independent",
                               "Voted to Overturn:Republican",
                               "Election Denial:Independent",
                               "Election Denial:Republican",
                               "Election Denial"),
          notes = "Estimated with survey weights and two-sided tests",
          star.cutoffs = c(0.05, 0.01, 0.001),
          omit.stat = c("aic","bic"),
          type = "latex",
          out = here("Tables","Supplementary","table_s17.tex"),
          header = F)